﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="GridView的使用._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <asp:GridView ID="gridStudent" runat="server" Width="100%" 
                              AutoGenerateColumns="False" AllowSorting="True" 
                              AllowPaging="True" onpageindexchanging="gridStudent_PageIndexChanging" onsorting="gridStudent_Sorting" 
                    >
                    <Columns>
                        <asp:BoundField  HeaderText="序号" />
                        <asp:BoundField DataField="StudentID" HeaderText="学号" 
                                        SortExpression="StudentID" />
                        <asp:HyperLinkField DataNavigateUrlFields="StudentID" 
                                            DataNavigateUrlFormatString="StudentDetails.aspx?id={0}" DataTextField="Name" 
                                            HeaderText="姓名" SortExpression="Name" />
                    
                        <asp:BoundField DataField="Department" HeaderText="系" 
                                        SortExpression="Department" />
                    </Columns>
                </asp:GridView>
            </div>
        </form>
    </body>
</html>